package com.lmqb.responces;

import java.io.Serializable;

import com.lmqb.constant.MsgError;
import com.lmqb.constant.MsgSuccess;

public class ResultData<T> implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int status; //0:可以添加审核记录  不为0：返回
	private T data;
	private String msg;

	public ResultData()
	{
	}

	public ResultData(int status, T data, String msg)
	{
		this.status = status;
		this.data = data;
		this.msg = msg;
	}

	public int getStatus()
	{
		return status;
	}

	public void setStatus(int status)
	{
		this.status = status;
	}

	public T getData()
	{
		return data;
	}

	public void setData(T data)
	{
		this.data = data;
	}

	public String getMsg()
	{
		return msg;
	}

	public void setMsg(String msg)
	{
		this.msg = msg;
	}

	public void setInfo(int status,T data,String msg){
		this.status=status;
		this.data=data;
		this.msg=msg;
	}
	
	public void setError(String msg){
		this.status=1;
		this.data=null;
		this.msg=msg;
	}
	
	public void setSuccess(T data,String msg){
		this.status=0;
		this.data=data;
		this.msg=msg;
	}
	
	public void setChengGong(T data){
		this.status=0;
		this.data=data;
		this.msg=MsgSuccess.ChengGong;
	}
	
	@Override
	public String toString()
	{
		return getClass().getSimpleName() + "[status=" + status + ", data=" + data + ", msg=" + msg + "]";
	}

	public void setNotLogin() {
		this.status=2;
		this.data=null;
		this.msg=MsgError.NotLogin;
		
	}

}
